<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2 id="test">测试通过id获取元素标签</h2>
</body>
<script type="text/javascript">
    var h2 = document.getElementById('test');
    console.log(typeof(h2));
    console.log(h2);
</script>
</html>